import request from '@/utils/request'

// 查询商品标签列表
export function listLabel(query) {
  return request({
    url: '/procurementmanagement/label/list',
    method: 'get',
    params: query
  })
}

// 获取商品关联的标签
export function getGoodsLabels(goodsId) {
  return request({
    url: `/procurementmanagement/label/relation/goods/${goodsId}`,
    method: 'get'
  })
}

// 更新商品标签关系
export function updateGoodsLabels(data) {
  return request({
    url: '/procurementmanagement/label/relation/update',
    method: 'post',
    data: data
  })
}

// 查询商品标签详细
export function getLabel(id) {
  return request({
    url: '/procurementmanagement/label/' + id,
    method: 'get'
  })
}

// 新增商品标签
export function addLabel(data) {
  return request({
    url: '/procurementmanagement/label',
    method: 'post',
    data: data
  })
}

// 修改商品标签
export function updateLabel(data) {
  return request({
    url: '/procurementmanagement/label',
    method: 'put',
    data: data
  })
}

// 删除商品标签
export function delLabel(id) {
  return request({
    url: '/procurementmanagement/label/' + id,
    method: 'delete'
  })
}
